[pull] master from marmelab:master#38
Conversation
Fix only the last notification is displayed when triggering consecutive notifications
|
Review these changes at https://app.gitnotebooks.com/Stars1233/react-admin/pull/38 |
Reviewer's GuideThe PR refactors the Notification component’s effect to correctly handle consecutive notifications by removing the auto-close branch and scoping the beforeunload listener to undoable notifications. It also parameterizes the BasicNotification story, adds a ConsecutiveNotifications example, and adds a test validating the sequential display of notifications. Sequence diagram for consecutive notification displaysequenceDiagram
actor User
participant ConsecutiveNotifications
participant BasicNotification1
participant BasicNotification2
participant Notification
User->>ConsecutiveNotifications: Render
ConsecutiveNotifications->>BasicNotification1: Render (message: 'hello, world')
ConsecutiveNotifications->>BasicNotification2: Render (message: 'goodbye, world')
BasicNotification1->>Notification: notify('hello, world')
BasicNotification2->>Notification: notify('goodbye, world')
Notification->>User: Display 'hello, world'
User->>Notification: Click to dismiss
Notification->>User: Display 'goodbye, world'
Class diagram for updated Notification component and storiesclassDiagram
class Notification {
+currentNotification
+open
+useEffect() // refactored effect for notification handling
}
class BasicNotification {
+message: string = 'hello, world' // now parameterized
+useEffect() // notifies with message
}
class ConsecutiveNotifications {
+Renders: BasicNotification
+Renders: BasicNotification (with message="goodbye, world")
}
Notification <.. BasicNotification : uses
ConsecutiveNotifications o-- BasicNotification : contains
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.1)
Can you help keep this open source service alive? 💖 Please sponsor : )
Summary by Sourcery
Enable back-to-back notifications and properly register the beforeunload handler only for undoable notifications by adjusting the notification closing logic.
New Features:
ConsecutiveNotificationsstory to demonstrate multiple notifications.BasicNotificationstory to accept a custom message prop.Bug Fixes:
Tests: